<template>
  <div class="app-container" style="text-align: center">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="奖项编号" width="95">
        <template slot-scope="scope">
          {{ scope.row.id }}
        </template>
      </el-table-column>
      <el-table-column align="center" label="奖项备注">
        <template slot-scope="scope">
          {{ scope.row.awardName }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="created_at" label="颁奖组织">
        <template slot-scope="scope">
          <span>{{ scope.row.organizationName }}</span>
        </template>
      </el-table-column>
      <el-table-column class-name="status-col" label="颁奖时间" width="200" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.awardTime }}</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  import {CLASSID_KEY, ROLE_KEY} from "../../constants";
  import {addOneHomework, getHomeworkList} from "../../api";
  import {formatTime} from "../../utils/timeFormat";
  import {awardQuery} from "../../api/student";

  export default {
    name: 'MyAwardList',
    data() {
      return {
        list: null,
        listLoading: true,
        role: localStorage.getItem(ROLE_KEY)
      }
    },
    methods: {
      formatTime: formatTime,
      checkDetail(id) {
        this.$router.push({ path: '/homework/detail/' + id })
      },
    },
    mounted() {
      this.listLoading = true
      this.list = [
        {
          id: 10001,
          studentId: 2011387,
          student: '方星星',
          awardId: 10001,
          awardName: '校一等奖学金',
          organizationId: '10001',
          organizationName: '学校',
          awardTime: '2020.1.1'
        }
      ]
      this.listLoading = false
      // awardQuery().then(res => {
      //   this.list = res.data;
      //   this.listLoading = false
      //   console.log(res.data)
      // })
    }
  }
</script>
